package com.pan.creational.single.obj;


/**
 * 饿汉式（推荐）
 *
 * 有懒加载问题
 */
public class SingleObject {


    private static SingleObject singleObject;

    static {
        singleObject = new SingleObject();
    }

    public void hello(){
        System.out.println("Hello World!");
    }
    public static SingleObject getInstance(){
        return singleObject;
    }
    private SingleObject(){

    }

}
